define([ "app", "jquery", "md5", "ecb", "services/UserService",
		"resources/UserResource", "resources/AddYokiCountryResource" ],
		function(app) {

			var deps = [ "$scope", "$state", "$window", "$modalInstance", "$location", "$stateParams", "UserService", "UserResource", "AddYokiCountryResource" ];

			function controller($scope, $state, $window, $modalInstance, $location, $stateParams, UserService, UserResource, AddYokiCountryResource) {
				
				
				$scope.saveCountry = function() {
					var file =$('#textfield').val();
					var formData = new FormData(document.forms.namedItem("fileinfo")); 
					if(file ==null || file==""){
						alert("请选中上传文件!");
						return;
					}else{
						
						AddYokiCountryResource.save($scope.countryVo,formData).success(function(data){
							if (data.fileId) {
								$modalInstance.close($scope.countryVo);
							}
			            });
					}
				};

				$scope.close = function($scope,AddYokiCountryResource) {
					$modalInstance.close();
				};
			}
			controller.$inject = deps;
			return app.lazy.controller("AddCountryController", controller);
		});
